package com.quickask.dao;

import com.quickask.common.Pager;
import com.quickask.entity.AsknowAnswerSetEntity;
import com.quickask.idao.IAnswerSetDao;

/**
 * Created by Administrator on 2015/9/30.
 */
public class AnswerSetDao extends BaseDao<AsknowAnswerSetEntity, Integer> implements IAnswerSetDao {
    /**
     * @param pageNo      页码
     * @param pageSize    页大小
     * @param questionId
     * @return
     */
    @Override
    public Pager<AsknowAnswerSetEntity> findAnswerPagerByQuestionId(int pageNo, int pageSize, int questionId) {
        return findPagerByFetchedHql("from AsknowAnswerSetEntity as aase where aase.questionId = ? order by aase.answerId desc", null, pageNo, pageSize, questionId);
    }

    /**
     * @param pageNo   页码
     * @param pageSize 页大小
     * @param userId   用户id
     * @return
     */
    @Override
    public Pager<AsknowAnswerSetEntity> findAnswerPagerByUserId(int pageNo, int pageSize, int userId) {
        return findPagerByFetchedHql("from AsknowAnswerSetEntity as aase where aase.userId = ? order by aase.answerId desc", null, pageNo, pageSize, userId);
    }
}
